package com.sjyl.kaoshitong.activities;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.sjyl.kaoshitong.BaseActionBarActivity;
import com.sjyl.kaoshitong.R;
import com.sjyl.kaoshitong.fragment.QATwitterFragment;

/**
 * Created by ChangerLow on 15/7/7.
 * Email: changerlow@qq.com
 */
public class QuestionDetailActivity extends BaseActionBarActivity {
    private static String TAG = "QuestionDetailActivity";
    private Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_container);
        toolbar = getActionBarToolbar();
        toolbar.setTitle("问答详情");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                overridePendingTransition(R.anim.do_nothing, R.anim.slide_out_to_right);
            }
        });
        String id = getIntent().getExtras().getString("id");

        Fragment fragment = QATwitterFragment.newInstance(id);
        FragmentManager fm = getSupportFragmentManager();
        fm.beginTransaction().add(R.id.container, fragment).commit();
    }


    @Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(R.anim.do_nothing, R.anim.slide_out_to_right);
    }
}
